#!/bin/bash

cd /usr/local/samba

u=`id $RUN_UID`
if [ -z "$u" ]
then
    useradd -u $RUN_UID -G wheel -M -N $RUN_USER
    echo 123 | passwd $RUN_USER --stdin

    sed -i "s/ligang/$RUN_USER/g" etc/smb.conf
    sed -i "s/centos7/$SERVER_NAME/g" etc/smb.conf

    echo -e "123\n123" | bin/pdbedit -a -u $RUN_USER --password-from-stdin
fi

sbin/smbd --configfile=/usr/local/samba/etc/smb.conf

sleep infinity
